]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
environment: Add adjustAnimationTime() helper
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 4 Jun 2014 22:13:14 +0000 (00:13 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 6 Aug 2019 18:50:43 +0000 (20:50 +0200)
As we currently use Tweener for all animations, we have a single place
for hooking up the enable-animations and slow-down-factor settings.
However that will no longer hold true when we'll start to use Clutter's
built-in animation facilities, so add a small helper function that
applies the necessary adjustments.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/22

js/ui/environment.js

index ce0c875fe87719ec933f203af7aa8e2c4cb70aa1..55d10198e8039124dbb813e03dc3b819acd684bb 100644 (file)
@@ -145,3 +145,17 @@ function init() {
     Tweener.init();
     String.prototype.format = Format.format;
 }
+
+// adjustAnimationTime:
+// @msecs: time in milliseconds
+//
+// Adjust @msecs to account for St's enable-animations
+// and slow-down-factor settings
+function adjustAnimationTime(msecs) {
+    let settings = St.Settings.get();
+
+    if (!settings.enable_animations)
+        return 1;
+    return settings.slow_down_factor * msecs;
+}
+